﻿//-------------------------------------------------------------------------------------------------------------------------------------
// Copyright (C) 2005 greatelsoft.com All Rights Reserved
//-------------------------------------------------------------------------------------------------------------------------------------

using System;
using System.Data.Common;
using System.Data;
using System.Data.OleDb;
using System.Collections.Generic;
using System.Text;
using System.Linq;
using Pub.Class;
using GTS.MiniBox.Entity;

namespace GTS.MiniBox.Helper {
    public partial class MonthMRInfoHelper {
        /// <summary>
        /// 批次缓存多少秒 x 5
        /// </summary>
        public static int cacheSeconds = 1440;

        public static IList<MonthMRInfo> SelectMonthByTime(string dbkey, int cstcode, int area, string startTime, string endTime) {
            string cacheNameKey = "GTS.MiniBox.SelectMonthByTimeCache_SelectMonthByTime_{0}_{1}_{2}_{3}".FormatWith(cstcode, area, startTime, endTime);
            return Cache2.Get<IList<MonthMRInfo>>(cacheNameKey, cacheSeconds, () => {
                DbParameter[] dbparam = new DbParameter[]{
                Data.MakeInParam("@Cstcode", (DbType)SqlDbType.Int, 4,cstcode),
                Data.MakeInParam("@Area", (DbType)SqlDbType.Int, 4,area),
                Data.MakeInParam("@StartTime", (DbType)SqlDbType.VarChar, 23,startTime),
                Data.MakeInParam("@EndTime", (DbType)SqlDbType.VarChar, 23,endTime)
                };
                return Data.Pool(dbkey).GetDataTable("report_monthmr", dbparam).ToList<MonthMRInfo>();
            });
        }
    }
}

